package org.lovo.util;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

public class StringUtil {
    //文件上传格式后缀
    public static final String UPLOAD_FORMAT[]={"image/jpeg","image/png","image/gif","image/bmp"};
    //文件上传目录
   // public static final String IMG_PATH="/home/img/";
    public static final String IMG_PATH="d:/img2/";

    /**
     * 如果str存在返回真，否则假
     * @param strings  取and
     * @return
     */
    public static boolean StringVerify(String...strings){
        boolean bl=true;
        for (String str:strings) {
            if (null == str ||"".equals(str)) {
                bl = false;
                break;
            }
        }
        return bl;
    }

    public static String getDateYYYYMMDDSS(){
        LocalDateTime dt = LocalDateTime.now(); // 当前日期和时间 获取到的总是以当前默认时区返回的
        DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
       return dtf.format(dt);
    }
    public static String getDateYYYYMMDD(){
        LocalDateTime dt = LocalDateTime.now(); // 当前日期和时间 获取到的总是以当前默认时区返回的
        DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd");
        return dtf.format(dt);
    }
}
